﻿public static class GlobalMembersGame_role_select
{

//* 初始化角色选择框 
	// ****************************************************************************
	// * Punch And Kick -- a simple 2D Fighting Game.
	// *
	// * Copyright (C) 2013 by
	// * Liu Chao
	// *
	// * This file is part of the Punch And Kick project, and may only be used,
	// * modified, and distributed under the terms of the GPLv2.
	// *
	// * (GPLv2 is abbreviation of GNU General Public License Version 2)
	// *
	// * By continuing to use, modify, or distribute this file you indicate that you
	// * have read the license and understand and accept it fully.
	// *
	// * The Punch And Kick project is distributed in the hope that it will be
	// * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
	// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL v2 for
	// * more details.
	// *
	// * You should have received a copy of the GPLv2 along with this file. It is
	// * usually in the LICENSE.TXT file, If not, see <http://www.gnu.org/licenses/>.
	// * **************************************************************************

	// ****************************************************************************
	// * Punch And Kick -- 一个普通的2D格斗游戏
	// *
	// * 版权所有 (C) 2013 归属于
	// * 刘超
	// *
	// * 这个文件是 Punch And Kick 项目的一部分，并且只可以根据GPLv2许可协议来使用、
	// * 更改和发布。
	// *
	// * (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
	// *
	// * 继续使用、修改或发布本文件，表明您已经阅读并完全理解和接受这个许可协议。
	// *
	// * Punch And Kick 项目是基于技术交流目的而加以散布的，但不负任何担保责任，例
	// * 如：稳定性、可玩性、趣味性等的担保，甚至没有适销性或特定用途的隐含担保，详
	// * 情请参照GPLv2许可协议。
	// *
	// * 您应已收到附随于本文件的GPLv2许可协议的副本，它通常在LICENSE.TXT文件中，如果
	// * 没有，请查看：<http://www.gnu.org/licenses/>.
	// * **************************************************************************

	//角色选择界面



	// ****************************************************************************
	// * Punch And Kick -- a simple 2D Fighting Game.
	// *
	// * Copyright (C) 2013 by
	// * Liu Chao
	// *
	// * This file is part of the Punch And Kick project, and may only be used,
	// * modified, and distributed under the terms of the GPLv2.
	// *
	// * (GPLv2 is abbreviation of GNU General Public License Version 2)
	// *
	// * By continuing to use, modify, or distribute this file you indicate that you
	// * have read the license and understand and accept it fully.
	// *
	// * The Punch And Kick project is distributed in the hope that it will be
	// * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
	// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL v2 for
	// * more details.
	// *
	// * You should have received a copy of the GPLv2 along with this file. It is
	// * usually in the LICENSE.TXT file, If not, see <http://www.gnu.org/licenses/>.
	// * **************************************************************************

	// ****************************************************************************
	// * Punch And Kick -- 一个普通的2D格斗游戏
	// *
	// * 版权所有 (C) 2013 归属于
	// * 刘超
	// *
	// * 这个文件是 Punch And Kick 项目的一部分，并且只可以根据GPLv2许可协议来使用、
	// * 更改和发布。
	// *
	// * (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
	// *
	// * 继续使用、修改或发布本文件，表明您已经阅读并完全理解和接受这个许可协议。
	// *
	// * Punch And Kick 项目是基于技术交流目的而加以散布的，但不负任何担保责任，例
	// * 如：稳定性、可玩性、趣味性等的担保，甚至没有适销性或特定用途的隐含担保，详
	// * 情请参照GPLv2许可协议。
	// *
	// * 您应已收到附随于本文件的GPLv2许可协议的副本，它通常在LICENSE.TXT文件中，如果
	// * 没有，请查看：<http://www.gnu.org/licenses/>.
	// * **************************************************************************


	//* 初始化角色选择框 
//	public static void Game_InitRoleSelectBox()
//	{
//		int i;
//		ActionData_ p_action;

//		if (window_is_inited != null)
//		{
//			return;
//		}
//		temp_space = GameSpace_New();
//		GameObjectLibrary_Create(ref temp_role_library);

//		window = Widget_New("window");
//		role_image_box = Widget_New(null);
//		role_image = GameObject_New(temp_space, ref temp_role_library);
//		btn_prev_role = Widget_New("button");
//		btn_next_role = Widget_New("button");
//		btn_select_role = Widget_New("button");

//		info_area = Widget_New(null);
//		skill_area = Widget_New(null);
//		label_hp_value = Widget_New("label");
//		label_role_name = Widget_New("label");
//		label_punch = Widget_New("label");
//		label_kick = Widget_New("label");
//		label_defense = Widget_New("label");
//		label_hp = Widget_New("label");
//		label_throw = Widget_New("label");
//		label_speed = Widget_New("label");

//		progbar_punch = Widget_New("progress_bar");
//		progbar_kick = Widget_New("progress_bar");
//		progbar_defense = Widget_New("progress_bar");
//		;
//		progbar_throw = Widget_New("progress_bar");
//		progbar_speed = Widget_New("progress_bar");

//		label_skilllist = Widget_New("label");

//		Window_ClientArea_Add(window, info_area);
//		Widget_Resize(info_area, Size(295,135));
//		Widget_SetAlign(info_area, ALIGN_TYPE_.ALIGN_TOP_CENTER, Pos(0,5));
//		Widget_SetBorder(info_area, Border(1,BORDER_STYLE_SOLID, RGB(200,200,200)));

//		Widget_Container_Add(info_area, role_image_box);
//		Widget_Resize(window, Size(320,300));
//		Window_SetTitleTextW(window, "选择游戏角色");

//		Widget_ConnectEvent(Window_GetCloseButton(window), EVENT_CLICKED, closebtn_clicked);

//		// 配置角色形象框部件的样式
//		Widget_Resize(role_image_box, Size(100,120));
//		Widget_SetBorder(role_image_box, Border(1,BORDER_STYLE_SOLID, RGB(200,200,200)));
//		Widget_SetBackgroundColor(role_image_box, RGB(230,230,230));
//		Widget_SetBackgroundTransparent(role_image_box, DefineConstantsGame_role_select.FALSE);
//		Widget_SetAlign(role_image_box, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(5,0));

//		// 载入各个角色的START动作
//		for(i =0; i<RoleID.TOTAL_ROLE_NUM; ++i)
//		{
//			p_action = ActionRes_Load(i, (int)ActionType.ACTION_START);
//			GameObject_AddAction(role_image, p_action, i);
//		}
//		current_select_role = (int)RoleID.ROLE_KUNIO;
//		// 播放角色的动作动画
//		GameObject_PlayAction(role_image);
//		// 将部件加入至角色形象框内
//		GameObject_AddToContainer(role_image, role_image_box);
//		// 设置坐标
//		GameObject_SetX(role_image, 45);
//		GameObject_SetY(role_image, 90);
//		Widget_Container_Add(role_image_box, label_role_name);
//		Widget_SetAlign(label_role_name, ALIGN_TYPE_.ALIGN_BOTTOM_CENTER, Pos(0,-5));

//		// 设置按钮上显示的文本
//		Button_TextW(btn_next_role, "下个角色");
//		Button_TextW(btn_prev_role, "上个角色");
//		Button_TextW(btn_select_role, "选择该角色");
//		// 禁止自动调整尺寸
//		Widget_SetAutoSize(btn_next_role, DefineConstantsGame_role_select.FALSE, 0);
//		Widget_SetAutoSize(btn_prev_role, DefineConstantsGame_role_select.FALSE, 0);
//		Widget_SetAutoSize(btn_select_role, DefineConstantsGame_role_select.FALSE, 0);
//		// 调整按钮尺寸
//		Widget_Resize(btn_next_role, Size(80,30));
//		Widget_Resize(btn_prev_role, Size(80,30));
//		Widget_Resize(btn_select_role, Size(80,30));
//		// 将按钮加入至窗口客户区
//		Window_ClientArea_Add(window, btn_next_role);
//		Window_ClientArea_Add(window, btn_prev_role);
//		Window_ClientArea_Add(window, btn_select_role);
//		// 设置位置
//		Widget_SetAlign(btn_prev_role, ALIGN_TYPE_.ALIGN_BOTTOM_LEFT, Pos(10,-10));
//		Widget_SetAlign(btn_select_role, ALIGN_TYPE_.ALIGN_BOTTOM_CENTER, Pos(0,-10));
//		Widget_SetAlign(btn_next_role, ALIGN_TYPE_.ALIGN_BOTTOM_RIGHT, Pos(-10,-10));
//		// 关联按钮点击事件
//		Widget_ConnectEvent(btn_prev_role, EVENT_CLICKED, btn_prev_role_clicked);
//		Widget_ConnectEvent(btn_next_role, EVENT_CLICKED, btn_next_role_clicked);
//		Widget_ConnectEvent(btn_select_role, EVENT_CLICKED, btn_select_role_clicked);

//		Widget_Container_Add(info_area, label_hp);
//		Widget_Container_Add(info_area, label_hp_value);
//		Widget_Container_Add(info_area, label_punch);
//		Widget_Container_Add(info_area, label_kick);
//		Widget_Container_Add(info_area, label_defense);
//		Widget_Container_Add(info_area, label_throw);
//		Widget_Container_Add(info_area, label_speed);
//		Widget_Container_Add(info_area, progbar_punch);
//		Widget_Container_Add(info_area, progbar_kick);
//		Widget_Container_Add(info_area, progbar_defense);
//		Widget_Container_Add(info_area, progbar_throw);
//		Widget_Container_Add(info_area, progbar_speed);
//		// 设置文本
//		Label_TextW(label_hp, "生命");
//		Label_TextW(label_punch, "拳力");
//		Label_TextW(label_kick, "腿力");
//		Label_TextW(label_defense, "防御");
//		Label_TextW(label_throw, "投掷");
//		Label_TextW(label_speed, "移速");
//		Widget_SetAlign(label_hp, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(115,-54));
//		Widget_SetAlign(label_punch, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(115,-32));
//		Widget_SetAlign(label_kick, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(115,-10));
//		Widget_SetAlign(label_defense, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(115,10));
//		Widget_SetAlign(label_throw, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(115,30));
//		Widget_SetAlign(label_speed, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(115,52));
//		// 设置进度条
//		ProgressBar_SetMaxValue(progbar_punch, 300);
//		ProgressBar_SetMaxValue(progbar_kick, 300);
//		ProgressBar_SetMaxValue(progbar_defense, 300);
//		ProgressBar_SetMaxValue(progbar_throw, 300);
//		ProgressBar_SetMaxValue(progbar_speed, 300);
//		Widget_Resize(progbar_punch, Size(145,18));
//		Widget_Resize(progbar_kick, Size(145,18));
//		Widget_Resize(progbar_defense, Size(145,18));
//		Widget_Resize(progbar_throw, Size(145,18));
//		Widget_Resize(progbar_speed, Size(145,18));
//		Widget_SetAlign(label_hp_value, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(145,-54));
//		Widget_SetAlign(progbar_punch, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(145,-31));
//		Widget_SetAlign(progbar_kick, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(145,-10));
//		Widget_SetAlign(progbar_defense, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(145,11));
//		Widget_SetAlign(progbar_throw, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(145,32));
//		Widget_SetAlign(progbar_speed, ALIGN_TYPE_.ALIGN_MIDDLE_LEFT, Pos(145,53));

//		Window_ClientArea_Add(window, skill_area);
//		Widget_Container_Add(skill_area, label_skilllist);
//		Widget_Resize(skill_area, Size(295,70));
//		Widget_SetBorder(skill_area, Border(1,BORDER_STYLE_SOLID, RGB(200,200,200)));
//		Widget_SetAlign(skill_area, ALIGN_TYPE_.ALIGN_BOTTOM_CENTER, Pos(0,-50));
//		Widget_SetAlign(label_skilllist, ALIGN_TYPE_.ALIGN_TOP_LEFT, Pos(5,5));

//		// 显示这些部件
//		Widget_Show(label_role_name);
//		Widget_Show(label_hp);
//		Widget_Show(label_hp_value);
//		Widget_Show(label_punch);
//		Widget_Show(label_kick);
//		Widget_Show(label_defense);
//		Widget_Show(label_throw);
//		Widget_Show(label_speed);
//		Widget_Show(label_skilllist);
//		Widget_Show(progbar_punch);
//		Widget_Show(progbar_kick);
//		Widget_Show(progbar_defense);
//		Widget_Show(progbar_throw);
//		Widget_Show(progbar_speed);
//		Widget_Show(btn_next_role);
//		Widget_Show(btn_prev_role);
//		Widget_Show(btn_select_role);
//		Widget_Show(role_image);
//		Widget_Show(role_image_box);
//		Widget_Show(info_area);
//		Widget_Show(skill_area);

//		RoleSelectBox_SetRole(RoleID.ROLE_KUNIO);
//		LCUISleeper_Create(sleeper);
//		window_is_inited = DefineConstantsGame_role_select.TRUE;
//		LCUIThread_Create(th_role_action_update, GameRoleSelectBox_UpdateRoleAction, null);
//	}

////* 获取已选择的角色 

//	//* 获取已选择的角色 
//	public static int Game_GetSelectedRole()
//	{
//		if (window_is_inited == null)
//		{
//			return -1;
//		}
//		LCUISleeper_StartSleep(sleeper, INT_MAX);
//		return current_select_role;
//	}

////* 显示角色选择框 

//	//* 显示角色选择框 
//	public static void Game_ShowRoleSelectBox()
//	{
//		if (window_is_inited == null)
//		{
//			return;
//		}
//		current_select_role = (int)RoleID.ROLE_KUNIO;
//		Widget_SetModal(window, DefineConstantsGame_role_select.TRUE);
//		Widget_Show(window);
//	}

////* 隐藏角色选择框 

//	//* 隐藏角色选择框 
//	public static void Game_HideRoleSelectBox()
//	{
//		if (window_is_inited == null)
//		{
//			return;
//		}
//		Widget_Hide(window);
//	}

//	//* 销毁角色选择框 
//	public static void Game_DestroyRoleSelectBox()
//	{
//		if (window_is_inited == null)
//		{
//			return;
//		}
//		window_is_inited = DefineConstantsGame_role_select.FALSE;
//		LCUIThread_Join(th_role_action_update, null);
//		Widget_Destroy(window);
//	}




	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define WINDOWS_SIZE Size(320,300)
	//#define WINDOWS_SIZE
	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define ROLE_IMAGE_BOX_SIZE Size(100,120)
	//#define ROLE_IMAGE_BOX_SIZE
	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define BTN_SIZE Size(80,30)
	//#define BTN_SIZE
	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define INFO_AREA_SIZE Size(295,135)
	//#define INFO_AREA_SIZE
	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define SKILL_AREA_SIZE Size(295,70)
	//#define SKILL_AREA_SIZE

	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define TEXT_NEXT_ROLE L"下个角色"
	//#define TEXT_NEXT_ROLE
	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define TEXT_PREV_ROLE L"上个角色"
	//#define TEXT_PREV_ROLE
	////C++ TO C# CONVERTER NOTE: The following #define macro was replaced in-line:
	////ORIGINAL LINE: #define TEXT_SELECT_ROLE L"选择该角色"
	//#define TEXT_SELECT_ROLE

	//internal static  LCUI_Widget_ *role_image = new ();
	//internal static  role_image_box;
	//internal static  LCUI_Widget_ *label_role_name = new ();
	//internal static  label_hp_value;
	//internal static  LCUI_Widget_ *btn_prev_role = new ();
	//internal static  btn_next_role;
	//internal static  btn_select_role;
	//internal static  LCUI_Widget_ *label_punch = new ();
	//internal static  label_kick;
	//internal static  label_defense;
	//internal static  LCUI_Widget_ *label_hp = new ();
	//internal static  label_throw;
	//internal static  label_speed;
	//internal static  LCUI_Widget_ *progbar_punch = new ();
	//internal static  progbar_kick;
	//internal static  progbar_defense;
	//internal static  LCUI_Widget_ *progbar_hp = new ();
	//internal static  progbar_throw;
	//internal static  progbar_speed;
	//internal static  LCUI_Widget_ *label_skilllist = new ();
	//internal static  LCUI_Widget_ *info_area = new ();
	//internal static  skill_area;

	//internal static LCUI_Sleeper sleeper = new LCUI_Sleeper();
	//internal static LCUI_BOOL window_is_inited = DefineConstantsGame_role_select.FALSE;

	//internal static LCUI_Thread th_role_action_update = new LCUI_Thread();

	//internal static GameSpaceData_ temp_space;
	//internal static LCUI_Queue temp_role_library = new LCUI_Queue();

	//internal static int current_select_role = 0;

	//internal static void closebtn_clicked(LCUI_Widget_ widget)//, ref LCUI_WidgetEvent unused)
	//{
	//	Game_HideRoleSelectBox();
	//	Game_DestroyRoleSelectBox();
	//	// 赋值为-1，表示当前并未选中角色 
	//	current_select_role = -1;
	//	LCUISleeper_BreakSleep(sleeper);
	//}

	internal static void GetSkillName(string in_skillname, ref string out_skillname)
	{
		if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_MACH_A_ATTACK) == 0)
		{
			out_skillname = "高速拳";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_MACH_B_ATTACK) == 0)
		{
			out_skillname = "高速踢";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_BIG_ELBOW) == 0)
		{
			out_skillname = "肘压";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_GUILLOTINE) == 0)
		{
			out_skillname = "断头台";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_TORNADO_ATTACK) == 0)
		{
			out_skillname = "龙卷攻击";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_JUMP_SPINKICK) == 0)
		{
			out_skillname = "高跳旋转落踢";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_BOMBKICK) == 0)
		{
			out_skillname = "爆裂踢";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_SOLID_DEFENSE) == 0)
		{
			out_skillname = "磐石防御";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_SPINHIT) == 0)
		{
			out_skillname = "自旋击";
		}
		else if(string.Compare(in_skillname, DefineConstantsGame_role_select.SKILLNAME_MACH_STOMP) == 0)
		{
			out_skillname = "自旋击";
		}
		else
		{
			out_skillname = "(未知)";
		}
	}

//	//* 选择角色 
//	public static void RoleSelectBox_SetRole(int role_id)
//	{
//		int i;
//		RoleInfo_ p_info;
//		char[] str = new char[256];
//		char[] tmp_str = new char[256];
//		char[] skillname = new char[32];

//		p_info = Game_GetRoleInfo(role_id);
//		Label_TextW(label_role_name, p_info.name);
//		swprintf(str, typeof(str), "%d", p_info.property.max_hp);
//		Label_TextW(label_hp_value, str);
//		ProgressBar_SetValue(progbar_punch, p_info.property.punch);
//		ProgressBar_SetValue(progbar_kick, p_info.property.kick);
//		ProgressBar_SetValue(progbar_defense, p_info.property.defense);
//		ProgressBar_SetValue(progbar_throw, p_info.property.throw);
//		ProgressBar_SetValue(progbar_speed, p_info.property.speed);
//		GameObject_SwitchAction(role_image, role_id);

//		str = "技能列表：\n";
//		for(i =0; i<p_info.total_skill; ++i)
//		{
//			GetSkillName(p_info.skills[i], ref skillname);
////C++ TO C# CONVERTER TODO TASK: The memory management function 'memcpy' has no equivalent in C#:
//			memcpy(tmp_str, str, typeof(str));
//			swprintf(str, typeof(str), "%s  %s", tmp_str, skillname);
//			if(i>0 && (i+1)%4 == 0)
//			{
//				str += "\n";
//			}
//		}
//		Label_TextW(label_skilllist, str);
//	}

//	internal static void btn_prev_role_clicked(LCUI_Widget_ widget, ref LCUI_WidgetEvent unused)
//	{
//		--current_select_role;
//		if(current_select_role < 0)
//		{
//			current_select_role = RoleID.TOTAL_ROLE_NUM-1;
//		}
//		RoleSelectBox_SetRole(current_select_role);
//	}

//	internal static void btn_next_role_clicked(LCUI_Widget_ widget, ref LCUI_WidgetEvent unused)
//	{
//		++current_select_role;
//		if(current_select_role >= RoleID.TOTAL_ROLE_NUM)
//		{
//			current_select_role = 0;
//		}
//		RoleSelectBox_SetRole(current_select_role);
//	}

//	internal static void btn_select_role_clicked(LCUI_Widget_ widget, ref LCUI_WidgetEvent unused)
//	{
//		Game_HideRoleSelectBox();
//		LCUISleeper_BreakSleep(sleeper);
//		Game_DestroyRoleSelectBox();
//	}

//	//* 更新角色的动作动画 
//	internal static void GameRoleSelectBox_UpdateRoleAction(IntPtr arg)
//	{
//		while (window_is_inited != null)
//		{
//			GameObjectLibrary_UpdateAction(ref temp_role_library);
//			LCUI_MSleep(10);
//		}
//	}
}
